Primitive recursive set function